module.exports = {
	lintOnSave: false,
	productionSourceMap: false,
	chainWebpack: config => {
		config.when(process.env.NODE_ENV === 'production' || process.env.NODE_ENV === 'development', config => {
			config.set('externals', {
				vue: 'Vue',
				"element-ui": "ELEMENT",
				'axios': 'axios',
				'vue-router': 'VueRouter',
			})
			config.optimization.splitChunks({
				chunks: 'all',
				cacheGroups: {
					vendor: {
						test: /[\\/]node_modules[\\/]/,
						name: 'vendors',
						chunks: 'initial',
					},
				}
			})
			config.optimization.runtimeChunk({
				name: (entrypoint) => `runtime-${entrypoint.name}`
			})
			config.plugin('webpack-bundle-analyzer').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
		})
	}
}